$("#userList").jqGrid({
   	url:'/outlet/outletList/?q=2',
	datatype: "json",
   	colNames:['Outlet Id','Outlet Name'],
   	colModel:[
   		{name:'outid',index:'outid', width:55,editable:false,editoptions:{readonly:true,size:10}},
   		{name:'outletname',index:'outletname', width:200,editable:true,editrules:{required:true},editoptions:{size:40}},
   	],
   	rowNum:10,
   	rowList:[10,20,30],
   	pager: '#outletPager',
   	sortname: 'outletname',
    viewrecords: true,
    sortorder: "asc",
    editurl: '/outlet/maniplulate/',
    caption:"Outlet Maintenance"
});
$("#outletList").jqGrid('navGrid','#outletPager',
{}, //options
{height:120,reloadAfterSubmit:true,beforeSubmit:validateData,closeAfterAdd: true,closeAfterEdit: true}, // edit options
{height:120,reloadAfterSubmit:true,beforeSubmit:validateData,closeAfterAdd: true,closeAfterEdit: true}, // add options
{reloadAfterSubmit:false}, // del options
{} // search options
);


//var issuccessMessage;
function validateData(postdata, formid) {
	var message;
	var issuccess;
	function set_message(newissuccess,newmessage) {
		issuccess = newissuccess;
		message = newmessage;
	}
	$.ajax({
     url: '/outlet/validateUserInfo',
     type: "POST",
     async: false, // set to false so order of operations is correct
     data: postdata,
     success: function(data){
		if(data) set_message(false,data);
		//else set_message(true,'Data successfully saved!');
	}});
	if(message)	return [false,message,"1"];
	else return [true,"","1"];;
}
